/** 
* 文 件 名:RiskAssessmentActivity
* Copyright (C) 2007-2012:杭州希禾信息技术有限公司 版权所有 
* 创 建 人:赵文斌
* 日    期:2012-3-20 下午7:38:34
* 修 改 人: 
* 日   期:
* 修改描述:
* 描   述:TODO
*/

package net.seehealth.healthpad.ui;

import java.util.ArrayList;
import java.util.List;

import net.seehealth.healthpad.Constants;
import net.seehealth.healthpad.R;
import net.seehealth.healthpad.application.adapter.DiseaseRiskAdapter;
import net.seehealth.healthpad.ui.view.ScrollTextView;
import android.os.Bundle;
import android.text.Html;
import android.view.View;
import android.view.WindowManager.LayoutParams;
import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.TextView;

/**
 * @className RiskAssessmentActivity
 * @author 赵文斌
 * @description 常用工具类
 * @date 2012-3-20 下午7:38:34
 */
public class RiskAssessmentActivity extends BaseActivity {
	/**
	 * 预测等级
	 */
	private TextView mForecast_text;
	/**
	 * 预测结果1
	 */
	private TextView mResult1_text;
	/**
	 * 预测结果2
	 */
	private TextView mResult2_text;
	
	/**
	 * 预测说明标题
	 */
	private TextView mExplain_text;
	
	private ListView mListView_dex;
	
	/**
	 * 预防建议标题
	 */
	private TextView mSuggestion_title_text;
	
	private TextView mSuggestion_content_text;
	
	/**
	 * 关闭按钮
	 */
	private ImageButton mClose_btn;
	
	private String mForecast = "您未来10年高血压的发病风险等级：";
	private String mForecast_level = "一般水平";
	
	/**
	 * 标题列表
	 */
	private List<String> mTitleData;
	/**
	 * 内容列表
	 */
	private List<String> mContentData;
	
	private DiseaseRiskAdapter mDiseaseRiskAdapter;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		initView();
		fillListData();
		initData();
	}
	private void initView(){
		setContentView(R.layout.pop_chronic_assessment);
		LayoutParams p = getWindow().getAttributes();  	// 获取对话框当前的参数值
		p.height = (int) (Constants.Screen.HEIGHT * 1.0);   	// 高度设置为屏幕的1.0
		p.width = (int) (Constants.Screen.WIDTH * 1.0);    // 宽度设置为屏幕的1.0
		mForecast_text = (TextView)findViewById(R.id.tv_ch_assessment_forecast);
		mListView_dex = (ListView)findViewById(R.id.listview_ch_assessment_des);
		mResult1_text = (TextView)findViewById(R.id.tv_ch_assessment_result1);
		mResult2_text = (TextView)findViewById(R.id.tv_ch_assessment_result2);
		mExplain_text = (TextView)findViewById(R.id.tv_ch_assessment_explain);
		mSuggestion_title_text =(TextView)findViewById(R.id.tv_ch_assessment_suggestion_title);
		mSuggestion_content_text=(TextView)findViewById(R.id.tv_ch_assessment_suggestion_content);
		mClose_btn = (ImageButton)findViewById(R.id.pop_close_btn);
		mClose_btn.setOnClickListener(mClickListener);
	}
	private void initData(){
		mForecast_text.setText(Html.fromHtml(getStringData(mForecast,"#000000")+getStringData(mForecast_level,"#18a3d7")));
		mResult1_text.setText(Html.fromHtml(getStringData("本次风险程度   ","#000000")
				+getStringData("4.27  ","#ffff4444")
				+getStringData("您的最佳状态  ","#000000")
				+getStringData("1.90","#18a3d7")
				));
		mResult2_text.setText(Html.fromHtml(getStringData("通过努力可以降低   ","#000000")
				+getStringData("2.27  ","#ffff4444")
				+getStringData("人群平均风险  ","#000000")
				+getStringData("1.90","#18a3d7")
				
				));
		mExplain_text.setText(Html.fromHtml(getStringData("说明：您在未来10年的患病可能于一般人相似,请养成良好的生活习惯","#000000")));
		mSuggestion_title_text.setText(Html.fromHtml(getStringData("预防建议","#000000")));
		mSuggestion_content_text.setText(Html.fromHtml(getStringData("饮食,吸烟会导致高血压。研究证明，吸一支烟后心率每分钟增加5-20次，收缩压增加mmhg","#000000")));
		mDiseaseRiskAdapter = new DiseaseRiskAdapter(this);
		mDiseaseRiskAdapter.setTitleData(mTitleData);
		mDiseaseRiskAdapter.setData(mContentData);
		mListView_dex.setAdapter(mDiseaseRiskAdapter);
	}
	
	/**
	 * 填充列表数据
	 */
	private void fillListData(){
		mTitleData = new ArrayList<String>();
		mContentData = new ArrayList<String>();
		for(int i = 0;i<7;i++){
			mTitleData.add("高血压风险评估");
			mContentData.add("    高血压病是指在静息状态下动脉收缩压和/或舒张压增高(>=140/90mmhg)常" +
					"伴有脂肪和糖代谢紊乱以及心.脑.肾和视网膜等器官功能性或器质性改变。由于分高血压" +
					"患者并我明显的临床症状，高血压又被称为人类健康的无形杀手");
		}
	}
	/**
	 * 点击事件
	 */
	View.OnClickListener mClickListener = new View.OnClickListener() {

		@Override
		public void onClick(View v) {
			switch (v.getId()) {
			case R.id.pop_close_btn:		// 关闭按钮
				finish();
				overridePendingTransition(R.anim.push_up_in, R.anim.push_up_out);
				break;

			default:
				break;
			}
		}
	};
}
